package com.dkm.biz.gl.repository.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.gl.domain.GlSwift;
import com.dkm.biz.gl.persistence.dao.GlSwiftQueryDao;
import com.dkm.biz.gl.persistence.entity.GlSwiftPo;
import com.dkm.biz.gl.repository.GlSwiftRepository;
import com.dkm.biz.repository.AbstractRepository;

/**
 * 对象功能:流水号 Repository接口的实现类
 * 开发公司:SKG.COM
 * 开发人员:RuanYangFa
 * 创建时间:2015-01-20 10:32:40
 */
@Repository
public class GlSwiftRepositoryImpl extends AbstractRepository<String, GlSwiftPo,GlSwift> implements GlSwiftRepository{
	  
	@Resource
	private  GlSwiftQueryDao glSwiftQueryDao;

	public GlSwift newInstance() {
		GlSwiftPo po = new GlSwiftPo();
		GlSwift glSwift = SpringHelper.getBean(GlSwift.class);
		glSwift.setData(po);
		return glSwift;
	}

	public GlSwift newInstance(GlSwiftPo po) {
		GlSwift glSwift = SpringHelper.getBean(GlSwift.class);
		glSwift.setData(po);
		return glSwift;
	} 
	
	@Override
	protected IQueryDao<String, GlSwiftPo> getQueryDao() {
		return glSwiftQueryDao;
	}
	
	public GlSwift getBySwiftKey(String key) {
		GlSwiftPo glSwiftPo = glSwiftQueryDao.getBySwiftKey(key);
		if(glSwiftPo!=null){
			GlSwift glSwift = SpringHelper.getBean(GlSwift.class);
			glSwift.setData(glSwiftPo);
			return glSwift;
		}
		return null;
	}
}
